package com.yjy.mq;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

@Component
public class OrderProducer {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    // 发送消息
    public void sendMsgOrder(String orderId, String tag) {
        rocketMQTemplate.send("test-v6-topic" + ":" + tag, MessageBuilder.withPayload(orderId).build());
    }
}
